home *** CD-ROM | disk | FTP | other *** search
/ Champak 66 / Vol 66.iso / games / bob_espo.swf / scripts / __Packages / MiniGames / JFS / JFSPatrick.as < prev   
Encoding:
Text File  |  2013-04-24  |  5.3 KB  |  213 lines

  1. class MiniGames.JFS.JFSPatrick extends State
  2. {
  3.    var oJelly;
  4.    var nX;
  5.    var nY;
  6.    var sState;
  7.    var mcRef;
  8.    static var sSTATE_IDLE = "Idle";
  9.    static var aSTATES_TAKEHOOK = ["Hook1","Hook2","Hook3","Hook4","Hook5","Hook6","Hook7","Hook8","Hook9","Hook10","Hook11"];
  10.    static var aSTATES_IDLEHOOK = ["IdleHook1","IdleHook2","IdleHook3","IdleHook4","IdleHook5","IdleHook6","IdleHook7","IdleHook8","IdleHook9","IdleHook10","IdleHook11"];
  11.    static var aSTATES_REEL = ["Reel1","Reel2","Reel3","Reel4","Reel5","Reel6","Reel7","Reel8","Reel9","Reel10","Reel11"];
  12.    static var nNB_FISHERROD_SOUNDS = 4;
  13.    static var nRANGE_DRAG = 50;
  14.    static var nFRAME_REACT_JELLY = 2;
  15.    static var nFRAME_DETACH_JELLY = 8;
  16.    static var nDRAG_TIME = 7;
  17.    function JFSPatrick(_mcRef)
  18.    {
  19.       super(_mcRef);
  20.       this.oJelly = null;
  21.       this.nX = 0;
  22.       this.nY = 0;
  23.       this.setState(MiniGames.JFS.JFSPatrick.sSTATE_IDLE);
  24.    }
  25.    function reel()
  26.    {
  27.       if(this.sState == MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[0] || (this.sState == MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[1] || (this.sState == MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[2] || (this.sState == MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[3] || (this.sState == MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[4] || (this.sState == MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[5] || (this.sState == MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[6] || (this.sState == MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[7] || (this.sState == MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[8] || (this.sState == MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[9] || this.sState == MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[10]))))))))))
  28.       {
  29.          this.setState(MiniGames.JFS.JFSPatrick.aSTATES_REEL[Number(this.oJelly.mcRef._name) - 1]);
  30.          Controller.getRef().getSounds().playRandomSound(MiniGames.JFS.JFSPatrick.nNB_FISHERROD_SOUNDS,"Reel",Controller.nSFX_VOLUME);
  31.       }
  32.    }
  33.    function takeHook(_oJelly)
  34.    {
  35.       if(this.sState == MiniGames.JFS.JFSPatrick.sSTATE_IDLE)
  36.       {
  37.          this.setState(MiniGames.JFS.JFSPatrick.aSTATES_TAKEHOOK[Number(_oJelly.mcRef._name) - 1]);
  38.          Controller.getRef().getSounds().playRandomSound(CTRLGame.nNB_THROW_SOUNDS,"IceBall_Throwed",Controller.nSFX_VOLUME);
  39.          this.oJelly = _oJelly;
  40.          this.oJelly.removeEvent();
  41.          this.nX = this.mcRef._xmouse;
  42.          this.nY = this.mcRef._ymouse;
  43.       }
  44.    }
  45.    function remove()
  46.    {
  47.       var _loc2_ = this.mcRef._xmouse - this.nX;
  48.       var _loc3_ = this.mcRef._ymouse - this.nY;
  49.       if(Math.abs(_loc2_) > MiniGames.JFS.JFSPatrick.nRANGE_DRAG || Math.abs(_loc3_) > MiniGames.JFS.JFSPatrick.nRANGE_DRAG)
  50.       {
  51.          this.reel();
  52.       }
  53.    }
  54.    function manageReel()
  55.    {
  56.       if(this.mcRef.mcState._currentframe == MiniGames.JFS.JFSPatrick.nFRAME_REACT_JELLY)
  57.       {
  58.          this.oJelly.react();
  59.       }
  60.       else if(this.mcRef.mcState._currentframe == MiniGames.JFS.JFSPatrick.nFRAME_DETACH_JELLY)
  61.       {
  62.          this.oJelly.leaveBus();
  63.          this.oJelly = null;
  64.       }
  65.       else if(this.stateFinished())
  66.       {
  67.          this.setState(MiniGames.JFS.JFSPatrick.sSTATE_IDLE);
  68.       }
  69.    }
  70.    function manageHook()
  71.    {
  72.       if(this.stateFinished())
  73.       {
  74.          this.setState(MiniGames.JFS.JFSPatrick.aSTATES_IDLEHOOK[Number(this.oJelly.mcRef._name) - 1]);
  75.       }
  76.    }
  77.    function Idle()
  78.    {
  79.    }
  80.    function Hook1()
  81.    {
  82.       this.manageHook();
  83.    }
  84.    function Hook2()
  85.    {
  86.       this.manageHook();
  87.    }
  88.    function Hook3()
  89.    {
  90.       this.manageHook();
  91.    }
  92.    function Hook4()
  93.    {
  94.       this.manageHook();
  95.    }
  96.    function Hook5()
  97.    {
  98.       this.manageHook();
  99.    }
  100.    function Hook6()
  101.    {
  102.       this.manageHook();
  103.    }
  104.    function Hook7()
  105.    {
  106.       this.manageHook();
  107.    }
  108.    function Hook8()
  109.    {
  110.       this.manageHook();
  111.    }
  112.    function Hook9()
  113.    {
  114.       this.manageHook();
  115.    }
  116.    function Hook10()
  117.    {
  118.       this.manageHook();
  119.    }
  120.    function Hook11()
  121.    {
  122.       this.manageHook();
  123.    }
  124.    function IdleHook1()
  125.    {
  126.       this.remove();
  127.    }
  128.    function IdleHook2()
  129.    {
  130.       this.remove();
  131.    }
  132.    function IdleHook3()
  133.    {
  134.       this.remove();
  135.    }
  136.    function IdleHook4()
  137.    {
  138.       this.remove();
  139.    }
  140.    function IdleHook5()
  141.    {
  142.       this.remove();
  143.    }
  144.    function IdleHook6()
  145.    {
  146.       this.remove();
  147.    }
  148.    function IdleHook7()
  149.    {
  150.       this.remove();
  151.    }
  152.    function IdleHook8()
  153.    {
  154.       this.remove();
  155.    }
  156.    function IdleHook9()
  157.    {
  158.       this.remove();
  159.    }
  160.    function IdleHook10()
  161.    {
  162.       this.remove();
  163.    }
  164.    function IdleHook11()
  165.    {
  166.       this.remove();
  167.    }
  168.    function Reel1()
  169.    {
  170.       this.manageReel();
  171.    }
  172.    function Reel2()
  173.    {
  174.       this.manageReel();
  175.    }
  176.    function Reel3()
  177.    {
  178.       this.manageReel();
  179.    }
  180.    function Reel4()
  181.    {
  182.       this.manageReel();
  183.    }
  184.    function Reel5()
  185.    {
  186.       this.manageReel();
  187.    }
  188.    function Reel6()
  189.    {
  190.       this.manageReel();
  191.    }
  192.    function Reel7()
  193.    {
  194.       this.manageReel();
  195.    }
  196.    function Reel8()
  197.    {
  198.       this.manageReel();
  199.    }
  200.    function Reel9()
  201.    {
  202.       this.manageReel();
  203.    }
  204.    function Reel10()
  205.    {
  206.       this.manageReel();
  207.    }
  208.    function Reel11()
  209.    {
  210.       this.manageReel();
  211.    }
  212. }
  213.